<%@ page language="java" import="java.util.*,shop.dao.*,shop.entity.*"  pageEncoding="utf-8"%>
<%

		String a_name = request.getParameter("a_name");
		String a_pass = request.getParameter("a_pass");
		String a_phone = request.getParameter("a_phone");
       String a_email = request.getParameter("a_email");

		Admin admin=new Admin();
		admin.setA_name(a_name);
		admin.setA_pass(a_pass);
		admin.setA_phone(a_phone);
		admin.setA_email(a_email);

		AdminDao admindao = new AdminDao();
       if(admindao.findname(a_name)==false){
            out
			.print("<script type='text/javascript'>alert('名字不可用。');history.go(-1);</script>");
			}
	    else{
         int count = admindao.insertAdmin(admin);
		     if (count > 0)
			out
			.print("<script type='text/javascript'>alert('成功添加管理员。');history.go(-1);</script>");
	     else
			out
			.print("<script type='text/javascript'>alert('添加失败。');history.go(-1);</script>");
     	}
%>